package com.serwis.app.entities;
// default package
// Generated 2014-07-29 18:57:10 by Hibernate Tools 3.4.0.CR1

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name="T_DELIVERER_ORDER")
public class DelivererOrder implements java.io.Serializable {


	private static final long serialVersionUID = 1L;
	private int delivererOrderId;
	private String delivererOrderNumber;
	private String paymentMethod;
	private Deliverer deliverer;
	private Status status;
	private Set<DelivererOrderDetails> delivererOrderDetails = new HashSet<DelivererOrderDetails>(0);

	public DelivererOrder() {
	}

	public DelivererOrder(String delivererOrderNumber, String paymentMethod, 
			Deliverer deliverer, Status status) {
		this.delivererOrderNumber = delivererOrderNumber;
		this.paymentMethod = paymentMethod;
		this.deliverer = deliverer;
		this.status = status;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name="DELIVERER_ORDER_ID",unique = true, nullable = false)
	public int getDelivererOrderId() {
		return delivererOrderId;
	}

	public void setDelivererOrderId(int delivererOrderId) {
		this.delivererOrderId = delivererOrderId;
	}

	@Column(name="DELIVERER_ORDER_NUMBER", nullable=false)
	public String getDelivererOrderNumber() {
		return delivererOrderNumber;
	}

	public void setDelivererOrderNumber(String delivererOrderNumber) {
		this.delivererOrderNumber = delivererOrderNumber;
	}

	@Column(name="PAYMENT_METHOD", nullable=false)
	public String getPaymentMethod() {
		return paymentMethod;
	}

	public void setPaymentMethod(String paymentMethod) {
		this.paymentMethod = paymentMethod;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "DELIVERER_ID", nullable = false)
	public Deliverer getDeliverer() {
		return deliverer;
	}

	public void setDeliverer(Deliverer deliverer) {
		this.deliverer = deliverer;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "STATUS_ID", nullable = false)
	public Status getStatus() {
		return status;
	}

	public void setStatus(Status status) {
		this.status = status;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "delivererOrder", cascade = CascadeType.ALL)
	public Set<DelivererOrderDetails> getDelivererOrderDetails() {
		return delivererOrderDetails;
	}

	public void setDelivererOrderDetails(
			Set<DelivererOrderDetails> delivererOrderDetails) {
		this.delivererOrderDetails = delivererOrderDetails;
	}

	
}
